<?php
session_start();
$idEmpresa = addslashes($_SESSION['idEmpresa']);
settype($idEmpresa, 'integer');
?>
<html lang="pt-br">
<head>
<link rel="shortcut icon" type="visao/css/image/x-icon" href="imagens/favicon1.ico" />
<link rel="stylesheet" href="/visao/css/estilo.css" type="text/css" media="all" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="visao/js/jquery-1.2.6.pack.js" type="text/javascript"></script>
<script type="text/javascript">$(document).ready(function(){
    $("#nome").focus();
    });</script>
</head>
<body>
    <?php
        if ($_GET['comum'] == 'cadLinha'){
            ?>    
            <h1>Linhas cadastradas</h1>
            <p>&nbsp;</p>
            <form action="/" method="GET">
                <input type="hidden" name="comum" value="cadNewLinha" />
                <table>
                    <tr>
                        <td></td>
                        <td><input type='submit' value="Novo"/></td>
                    </tr>
                </table>
            </form>
    <p>&nbsp;</p>
            <?php
            include_once 'modelo/modeloLinha.php';
            $linhas = getLinha();
            $numLinhas = mysql_num_rows($linhas);
                echo '<table class="relatorio"><tr>';
                echo '<th width="150">Linha</th>';
                echo '<th width="100">Editar</th>';
                echo '</tr>';
            for ($i=0;$i<$numLinhas;$i++){
                $arrayLinhas = mysql_fetch_array($linhas);
                mysql_data_seek($arrayLinhas, $i);
                
                echo '<tr><form action="/" method="POST"><input type="hidden" name="operacao" value="alterarLinha" /><input type="hidden" name="id" value="'.$arrayLinhas['id'].'" />';
                echo '<td align="center"><input type="text" name="endereco" value="'.$arrayLinhas['endereco'].'" /></td>';
                echo '<td align="center"><input type="submit" value="Alterar" /></td></form>';
                echo '</tr>';
            }
            echo '</table>';
        }
        if ($_GET['comum'] == 'cadNewLinha'){
        
        ?>
    <h1>Cadastrar Linha</h1>
    <p>&nbsp;</p>
    <form action='/' method="POST">
        <input type='hidden' name='operacao' value='cadLinha'/>
    <table>
        <tr>
            <td>Linha (ex: Linha 160 Norte):&nbsp;<br/>
                <input type="text"  name="endereco" size="30" maxlength="99" id="nome"/>
            </td>
            <td><br/>
                <input type="submit" value="Cadastrar"/>
            </td>
        </tr>
    </table>
    </form>
    <?php
    }
    ?>
</body>

</html>